<template>
    <div class="tip-box" :style=" getTime ">{{ msg }}</div>
</template>
<script>
export default {
    data() {
        return {
            msg: "默认消息",
            time: 0
        };
    },
    computed: {
        getTime() {
            return "animation-duration:" + this.time + "ms";
        }
    },
    mounted() {
        document.body.appendChild(this.$el);
        setTimeout(() => {
            document.body.removeChild(this.$el);
            this.$destroy();
        }, this.time);
    }
};
</script>
<style>
.tip-box {
    width:300px;
    height:300px;
    color:cyan;
    font-size: 32px;
    font-weight: bold;
    text-align: center;
    line-height: 300px;
    border-radius: 50px;
    position: fixed;
    background-color: rgba(236, 229, 229, 0.6);
    /* color: white; */
    padding: 6px 12px;
    border-radius: 60px;
    min-width: 50px;
    text-align: center;
    margin-left: 50%;
    /* margin-top:50%; */
    transform: translate(-50%, -100%);
    font-size: 16;
    animation: tipFade 1;
    /* animation-duration: ; */
    z-index: 100;
    top: 0px;
    opacity: 0;
}

@keyframes tipFade {
    0% {
        transform: translate(-50%, -100%);
        opacity: 0;
    }

    16% {
        transform: translate(-50%, 100%);
        opacity: 1;
    }

    84% {
        transform: translate(-50%, 100%);
        opacity: 1;
    }

    100% {
        transform: translate(-50%, -100%);
        opacity: 0;
    }
}
</style>